package com.yourenbang.lingyun.transaction.web.service.impl.pay;

import com.yourenbang.lingyun.constants.BizCodeMessages;
import com.yourenbang.lingyun.constants.enums.fund.AccountType;
import com.yourenbang.lingyun.constants.enums.pay.PayFromEnum;
import com.yourenbang.lingyun.core.exception.UserBizException;

import java.util.Arrays;
import java.util.List;

/**
 * 支付账户类型配置类
 */
public class PayAccountConfig {

    /**
     * 今日收入账户
     */
    public static List<Integer> accountTypeTodayIncome(Short platNo) {
        return Arrays.asList(
                AccountType.getFullCode(AccountType.ALLY, platNo),
                AccountType.getFullCode(AccountType.CREDIT_COMMISSION, platNo),
                AccountType.getFullCode(AccountType.SHOPPING_SCORE, platNo),
                AccountType.getFullCode(AccountType.ALLY_REACH, platNo),
                AccountType.getFullCode(AccountType.CONVERSION, platNo),
                AccountType.getFullCode(AccountType.ALLY_V2, platNo)
        );
    }

    /**
     * 返现收益账户
     */
    public static List<Integer> accountTypeCashEarnings(Short platNo) {
        return Arrays.asList(
                AccountType.getFullCode(AccountType.ALLY, platNo),
                AccountType.getFullCode(AccountType.ALLY_REACH, platNo)
        );
    }

    /**
     * 推卡收益账户
     */
    public static List<Integer> accountTypeCreditEarnings(Short platNo) {
        return Arrays.asList(AccountType.getFullCode(AccountType.CREDIT_COMMISSION, platNo));
    }

    /**
     * 获取 凌云支付订单号 前缀
     */
    public static String getOrderPrefix(String payFrom) {
        if  (PayFromEnum.yxy_topup.isEquals(payFrom)) {
            return "YXYCZ";
        }
        return "OTHER";
    }

    /**
     * 系统-账户类型
     */
    public static Integer formatSysAccountType(String payFrom, Short platNo) {
//        if (PayFromEnum.kllc_topup.isEquals(payFrom)) {                 //快收充值
//            return AccountType.getFullCode(AccountType.ALLY, platNo);
//        } else if (PayFromEnum.klks_purchase.isEquals(payFrom)) {       //快收采购机具
//            return AccountType.getFullCode(AccountType.ALLY_WITHDRAW, platNo);
//        } else if (PayFromEnum.yxy_enroll_586_pay.isEquals(payFrom)) {       //586报名支付
//            return AccountType.getFullCode(AccountType.ALLY_WITHDRAW, platNo);
//        } else if (PayFromEnum.yxy_enroll_586_update_pay.isEquals(payFrom)) {       //586报名支付
//            return AccountType.getFullCode(AccountType.ALLY_WITHDRAW, platNo);
//        } else if (PayFromEnum.zyj_topup.isEquals(payFrom)) {           //众赢嘉充值
//            return AccountType.getFullCode(AccountType.ALLY, platNo);
//        } else if (PayFromEnum.zyj_purchase.isEquals(payFrom)) {        //众赢嘉采购机具
//            return AccountType.getFullCode(AccountType.ALLY_WITHDRAW, platNo);
//        } else

        if (PayFromEnum.yxy_topup.isEquals(payFrom)) {           //银小云充值
            return AccountType.getFullCode(AccountType.ALLY, platNo);
        } else if (PayFromEnum.yxy_purchase.isEquals(payFrom)) {        //银小云采购机具
            return AccountType.getFullCode(AccountType.SYS_V2_WITHDRAW, platNo);
        }
        throw new UserBizException(BizCodeMessages.WITHDRAW_TYPE_OFF);
    }

    /**
     * 用户-账户类型
     */
    public static Integer formatUserAccountType(String payFrom, Short platNo) {
//        if (PayFromEnum.kllc_topup.isEquals(payFrom)) {                 //快收充值
//            return AccountType.getFullCode(AccountType.ALLY, platNo);
//        } else if (PayFromEnum.klks_purchase.isEquals(payFrom)) {       //快收采购机具
//            return AccountType.getFullCode(AccountType.ALLY, platNo);
//        } else if (PayFromEnum.yxy_enroll_586_pay.isEquals(payFrom)) {       //586报名
//            return AccountType.getFullCode(AccountType.ALLY, platNo);
//        } else if (PayFromEnum.yxy_enroll_586_update_pay.isEquals(payFrom)) {       //586报名
//            return AccountType.getFullCode(AccountType.ALLY, platNo);
//        } else if (PayFromEnum.zyj_topup.isEquals(payFrom)) {           //众赢嘉充值
//            return AccountType.getFullCode(AccountType.ALLY, platNo);
//        } else if (PayFromEnum.zyj_purchase.isEquals(payFrom)) {        //众赢嘉采购机具
//            return AccountType.getFullCode(AccountType.ALLY, platNo);
//        } else

        if (PayFromEnum.yxy_topup.isEquals(payFrom)) {           //银小云充值
            return AccountType.getFullCode(AccountType.ALLY_V2, platNo);
        } else if (PayFromEnum.yxy_purchase.isEquals(payFrom)) {        //银小云采购机具
            return AccountType.getFullCode(AccountType.ALLY_V2, platNo);
        }
        throw new UserBizException(BizCodeMessages.WITHDRAW_TYPE_OFF);
    }

    /**
     * app支付 描述
     */
    public static String formatAppPayBody(Short platNo) {
        return "友仁帮平台";

    }

}
